printeditor: Create the dialog every time
authorMatthias Clasen <mclasen@redhat.com>
Sat, 8 Aug 2020 13:38:35 +0000 (09:38 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 8 Aug 2020 15:48:32 +0000 (11:48 -0400)
Trying to work around gtk_show_about_dialog() is
not worth it, just recreate the dialog from scratch.

demos/print-editor/print-editor.c

index 338274a7ebf9c373068c0ffa5a8bbdfb82113634..892fc152a2187268ada0c78a056fd7bdc44c530c 100644 (file)
@@ -608,6 +608,7 @@ activate_about (GSimpleAction *action,
     "The GTK Team",
     NULL
   };
+  GtkWidget *dialog;
 
   os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
   os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
@@ -642,7 +643,8 @@ activate_about (GSimpleAction *action,
                              gtk_get_minor_version (),
                              gtk_get_micro_version ());
 
-  gtk_show_about_dialog (GTK_WINDOW (main_window),
+  dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
+                         "transient-for", main_window,
                          "program-name", "GTK Print Editor",
                          "version", version,
                          "copyright", "© 2006-2020 Red Hat, Inc",
@@ -654,9 +656,11 @@ activate_about (GSimpleAction *action,
                          "title", "About GTK Print Editor",
                          "system-information", sysinfo->str,
                          NULL);
-  gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (g_object_get_data (G_OBJECT (main_window), "gtk-about-dialog")),
+  gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
                                        _("Maintained by"), maintainers);
 
+  gtk_window_present (GTK_WINDOW (dialog));
+
   g_string_free (sysinfo, TRUE);
   g_free (version);
 }